package com.kefu.robot.vo;

import javax.validation.constraints.Size;

import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.robot.model.RobotDocType;

import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "词条类型")
public class RobotDocTypeInsertVo extends AbstractInsertVo<RobotDocType> {
    @Size(max = 32)
    @ApiModelProperty(name = "parentId", value = "上级id,没有上级传0")
    private String parentId;
    @ApiModelProperty(name = "robotNo", value = "机器人")
    private Integer robotNo;
    @ApiModelProperty(name = "docPattern", value = "模式：0单轮问题，1多轮问题")
    private Integer docPattern;
    @Size(max = 32)
    @ApiModelProperty(name = "name", value = "分类名称")
    private String name;

    @Override
    public RobotDocType convert() {
        RobotDocType info = new RobotDocType();
        info.setParentId(parentId);
        info.setRobotNo(robotNo);
        info.setDocPattern(docPattern);
        info.setName(name);

        KefuContext context = KefuContext.getKefuContext();

        info.setId(IdUtil.simpleUUID());

        info.setTenantId(context.getTenantId());
        info.setCreateTime(context.getNow());
        info.setCreateUser(context.getUserId());
        info.setUpdateTime(context.getNow());
        info.setUpdateUser(context.getUserId());


        return info;

    }

}